package org.blogwu.learn.designpattern.chapter8.hungry;

import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class Test2 {

    public static void main(String[] args) throws IllegalAccessException, InstantiationException, IOException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException {

        HungrySingleton hungrySingleton = HungrySingleton.getInstance();
        System.out.println(hungrySingleton);
        Class cl = HungrySingleton.class;
        Constructor<HungrySingleton> constructor = cl.getDeclaredConstructor();
        constructor.setAccessible(true);
        HungrySingleton newhungrySingleton = constructor.newInstance();
        System.out.println(newhungrySingleton);

    }
}
